Package edu.claflin.finder.algo
Class BronKerbosch
java.lang.Object
edu.claflin.finder.algo.Algorithm
edu.claflin.finder.algo.BronKerbosch
- All Implemented Interfaces:
Processable<Graph,Graph>
Bron-Kersboch Algorithm to find Maximal Cliques and Bicliques.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class edu.claflin.finder.algo.Algorithm
Algorithm.GraphSortOrder -
Field Summary
FieldsFields inherited from class edu.claflin.finder.algo.Algorithm
args, PROP_PROGRESS -
Constructor Summary
ConstructorsConstructorDescriptionBronKerbosch(ArgumentsBundle bundle) Public constructor for initializing the Bron Kersbboch with default conditions. -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddEdgesInParititeSet(Graph graph, List<Node> list) Adds edges to a Graph between all Nodes in a partite set.private voidbronKerbosch(List<List<Node>> results, List<Node> clique, List<Node> candidates, List<Node> excluded) Recursive helper method to do the above.bronKerboschBiclique(Graph graph) Finds all bicliques within a bipartite graph.bronKerboschClique(Graph graph) Given a graph, finds all complete subgraphs.maximalBicliques(Graph graph) Gets the Maximal Complete Bipartite Graphs from the input Graph using Bron-Kersboch.maximalCliques(Graph graph) Given a graph, finds all complete subgraphs, and then returns the largest one.nameGraphs(List<Graph> graphs, String originalName, boolean bipartite) Processes data.private voidremoveEdgesInPartiteSet(Graph graph, List<Node> list) Removes edges in a Graph between all Nodes in a partite set.toString()Methods inherited from class edu.claflin.finder.algo.Algorithm
addPropertyChangeListener, cull, getGraphSortOrder, getMinNodeCount, getPartiteNumber, getWeightName, removePropertyChangeListener, setGraphSortOrder, setMinNodeCount, setPartiteNumber, setProgress, setWeightName, zeropad
-
Field Details
-
bipartite
private boolean bipartite
-
-
Constructor Details
-
BronKerbosch
Public constructor for initializing the Bron Kersbboch with default conditions.- Parameters:
bundle- the ArgumentsBundle containing the instantiation arguments.
-
-
Method Details
-
toString
-
process
Processes data.
Finds the Maximal Cliques of a Graph or the Maximal Biclique of a Bipartite Graph if the bipartite argument is set to true.- Parameters:
graph- theGraphobject to search through.- Returns:
- the ArrayList of Graph objects holding all found subgraphs.
-
maximalCliques
Given a graph, finds all complete subgraphs, and then returns the largest one.- Parameters:
graph- the graph- Returns:
- the largest complete subgraph (clique)
-
maximalBicliques
Gets the Maximal Complete Bipartite Graphs from the input Graph using Bron-Kersboch.- Parameters:
graph- the input Graph- Returns:
- the Maximal Complete Bipartite Graphs
-
bronKerboschClique
Given a graph, finds all complete subgraphs.- Parameters:
graph- the graph- Returns:
- a List of complete subgraphs, unordered
-
bronKerboschBiclique
Finds all bicliques within a bipartite graph. This is done by adding edges between every nodes in a partite set in both partite sets, using the above algorithm, and then removing all the added edges from the results. THIS ONLY WORKS ON GRAPHS THAT ARE BIPARTITE!- Parameters:
graph- the bipartite graph- Returns:
- array list of bicliques
-
bronKerbosch
private void bronKerbosch(List<List<Node>> results, List<Node> clique, List<Node> candidates, List<Node> excluded) Recursive helper method to do the above.- Parameters:
results- result list. Passed between recursive calls to create outputclique- the current Clique being constructed; Graph r in Wikipedia linkcandidates- the candidate Nodes for the Clique; Graph p in Wikipedia linkexcluded- the Nodes to be excluded from the Clique; Graph x in Wikipedia link
-
addEdgesInParititeSet
Adds edges to a Graph between all Nodes in a partite set. Remove these edges later withremoveEdgesInPartiteSet(edu.claflin.finder.logic.Graph,java.util.List<edu.claflin.finder.logic.Node>).- Parameters:
graph- the Graph to add the Edges tolist- the partite set
-
removeEdgesInPartiteSet
Removes edges in a Graph between all Nodes in a partite set.- Parameters:
graph- the Graph to remove the Edges fromlist- the partite set
-
nameGraphs
-